import { legacy_createStore as createStore, combineReducers, applyMiddleware } from 'redux'
// 引入购物车模块
import { carReducer } from './car/car'
// 引入用户模块
import { userReducer } from './user/user'
// 引入插件
import logger from 'redux-logger'
// 合并 reducer
const reducer = combineReducers({
	car: carReducer,
	user: userReducer
})

// 创建仓库
const store = createStore(reducer, applyMiddleware(logger))


// 获取仓库数据类型
export type RootState = ReturnType<typeof store.getState>

// 抛出
export default store